<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS Text Wrapping Properties Guide</title>
  <style>
  * {
    box-sizing: border-box;
  }

  body {
    font-family: Helvetica, Arial, sans-serif;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
  }

  h1, h2, h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
  }

  h1 {
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
  }

  p {
    margin-bottom: 1em;
  }

  .property-section {
    margin-bottom: 40px;
    padding: 20px;
    border-radius: 5px;
    background-color: #f8f8f8;
  }

  .demo-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
  }

  .demo-box {
    width: 280px;
    height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    background-color: white;
    overflow: auto;
    position: relative;
  }

  .demo-label {
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #ccc;
  }

  .demo-text {
    font-size: 14px;
  }

  .long-word {
    color: #d35400;
  }

  .code {
    font-family: monospace;
    background-color: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
  }

  th, td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
  }

  th {
    background-color: #f2f2f2;
  }

  tr:nth-child(even) {
    background-color: #f9f9f9;
  }

  .browser-support {
    margin-top: 15px;
  }

  .support-good {
    color: #27ae60;
  }

  .support-partial {
    color: #f39c12;
  }

  .support-poor {
    color: #e74c3c;
  }

  .controls {
    margin: 15px 0;
  }

  input, textarea {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: Helvetica, Arial, sans-serif;
    width: 100%;
    max-width: 500px;
  }

  button {
    padding: 8px 16px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
  }

  button:hover {
    background-color: #3a7bc8;
  }

  .toc {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 30px;
  }

  .toc ul {
    margin: 0;
    padding-left: 20px;
  }

  .toc li {
    margin-bottom: 5px;
  }

  .note {
    background-color: #e7f5ff;
    padding: 10px 15px;
    border-left: 4px solid #4a90e2;
    margin: 15px 0;
  }

  .warning {
    background-color: #fff7e6;
    padding: 10px 15px;
    border-left: 4px solid #f39c12;
    margin: 15px 0;
  }
  </style>
</head>
<body>
  <h1>CSS Text Wrapping Properties Guide</h1>
  <p><strong>WARNING:</strong> This guide was <a href="https://claude.ai/share/909d9faf-2667-405e-9cc9-82f1d860f517">written by an LLM</a> and has not been fact-checked - it may include errors.</p>
  <div class="toc">
    <h2>Table of contents</h2>
    <ul>
      <li><a href="#word-wrap">word-wrap / overflow-wrap</a></li>
      <li><a href="#word-break">word-break</a></li>
      <li><a href="#white-space">white-space</a></li>
      <li><a href="#text-overflow">text-overflow</a></li>
      <li><a href="#hyphens">hyphens</a></li>
      <li><a href="#line-break">line-break</a></li>
      <li><a href="#text-wrap">text-wrap</a></li>
    </ul>
  </div>

  <p>This guide demonstrates all CSS properties that control text wrapping behavior with examples and browser compatibility information. Text wrapping is how browsers handle the flow of text when it reaches the edge of its containing element.</p>

  <section id="word-wrap" class="property-section">
    <h2>Word-wrap / overflow-wrap property</h2>
    
    <p><span class="code">word-wrap</span> (now also called <span class="code">overflow-wrap</span>) specifies whether the browser should break long words when they overflow their container.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">overflow-wrap: normal (default)</div>
        <div class="demo-text" style="overflow-wrap: normal;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word that will overflow its container when using normal wrapping.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">overflow-wrap: break-word</div>
        <div class="demo-text" style="overflow-wrap: break-word;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word that will break at arbitrary points to prevent overflow.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">overflow-wrap: anywhere</div>
        <div class="demo-text" style="overflow-wrap: anywhere;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word that will break even between characters to optimize line filling.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Good in modern browsers, IE not supported</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>normal</td>
        <td>Words break only at allowed break points (like spaces or hyphens)</td>
      </tr>
      <tr>
        <td>break-word</td>
        <td>Words will break at arbitrary points if they're too long for their container</td>
      </tr>
      <tr>
        <td>anywhere</td>
        <td>Like break-word, but also creates soft wrap opportunities for better line filling</td>
      </tr>
    </table>

    <div class="note">
      <p><strong>Note:</strong> <span class="code">word-wrap</span> is the original property name and <span class="code">overflow-wrap</span> is the modern standard name for the same property. For best compatibility, you can use both in your CSS.</p>
    </div>
  </section>

  <section id="word-break" class="property-section">
    <h2>Word-break property</h2>
    
    <p><span class="code">word-break</span> specifies how word breaks should occur, particularly for non-western languages.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">word-break: normal (default)</div>
        <div class="demo-text" style="word-break: normal;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word using normal breaking rules. Chinese text like 这是一些中文文本示例 follows language-specific rules.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">word-break: break-all</div>
        <div class="demo-text" style="word-break: break-all;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word that will break at any character. Even regular words break between any characters.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">word-break: keep-all</div>
        <div class="demo-text" style="word-break: keep-all;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word. Chinese text like 这是一些中文文本示例 won't break between characters.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Good in modern browsers, partial in older ones</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">word-break: break-word (deprecated)</div>
        <div class="demo-text" style="word-break: break-word;">
          This is a regular sentence with the <span class="long-word">supercalifragilisticexpialidocioussupercalifragilisticexpialidocious</span> word showing similar behavior to overflow-wrap: break-word, but is now deprecated.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Varies, deprecated in favor of overflow-wrap</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>normal</td>
        <td>Default breaking rules for each language</td>
      </tr>
      <tr>
        <td>break-all</td>
        <td>Words break at any character to prevent overflow</td>
      </tr>
      <tr>
        <td>keep-all</td>
        <td>Prevents breaks for Chinese, Japanese, and Korean text</td>
      </tr>
      <tr>
        <td>break-word</td>
        <td>Deprecated, similar to overflow-wrap: break-word</td>
      </tr>
    </table>

    <div class="warning">
      <p><strong>Important:</strong> The <span class="code">word-break: break-word</span> value is now deprecated and behaves similarly to <span class="code">overflow-wrap: break-word</span>. Use overflow-wrap for better compatibility.</p>
    </div>
  </section>

  <section id="white-space" class="property-section">
    <h2>White-space property</h2>
    
    <p><span class="code">white-space</span> controls how whitespace (spaces, tabs, newlines) is handled within an element.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">white-space: normal (default)</div>
        <div class="demo-text" style="white-space: normal;">
          This    text    has    multiple    spaces
          and
          line
          breaks, but they are collapsed into single spaces, and text wraps as needed.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">white-space: nowrap</div>
        <div class="demo-text" style="white-space: nowrap;">
          This text will appear in a single line no matter how long it is and won't wrap to the next line until a <br> tag or explicit line break is encountered.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">white-space: pre</div>
        <div class="demo-text" style="white-space: pre;">
          This    text    has    multiple    spaces
          and
          line
          breaks, and they are all preserved exactly as written. No wrapping occurs.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">white-space: pre-wrap</div>
        <div class="demo-text" style="white-space: pre-wrap;">
          This    text    has    multiple    spaces
          and
          line
          breaks, they are preserved, and text will also wrap at the end of lines when needed.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">white-space: pre-line</div>
        <div class="demo-text" style="white-space: pre-line;">
          This    text    has    multiple    spaces
          and
          line
          breaks, spaces are collapsed, but line breaks are preserved, and text wraps.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">white-space: break-spaces</div>
        <div class="demo-text" style="white-space: break-spaces;">
          This    text    has    multiple    spaces
          and
          line
          breaks, like pre-wrap but spaces at the end of lines and between words won't collapse.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Good in modern browsers, not in IE</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Whitespace collapse</th>
        <th>Line breaks preserved</th>
        <th>Text wrapping</th>
      </tr>
      <tr>
        <td>normal</td>
        <td>Yes</td>
        <td>No</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>nowrap</td>
        <td>Yes</td>
        <td>No</td>
        <td>No</td>
      </tr>
      <tr>
        <td>pre</td>
        <td>No</td>
        <td>Yes</td>
        <td>No</td>
      </tr>
      <tr>
        <td>pre-wrap</td>
        <td>No</td>
        <td>Yes</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>pre-line</td>
        <td>Yes</td>
        <td>Yes</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>break-spaces</td>
        <td>No</td>
        <td>Yes</td>
        <td>Yes, with preserved spaces</td>
      </tr>
    </table>
  </section>

  <section id="text-overflow" class="property-section">
    <h2>Text-overflow property</h2>
    
    <p><span class="code">text-overflow</span> specifies how overflowed content is signaled to users. Note that this requires <span class="code">overflow: hidden</span> and typically <span class="code">white-space: nowrap</span> to work properly.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">text-overflow: clip (default)</div>
        <div class="demo-text" style="white-space: nowrap; overflow: hidden; text-overflow: clip;">
          This is a very long text that will be clipped at the boundary of its container box without any special indicator.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">text-overflow: ellipsis</div>
        <div class="demo-text" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
          This is a very long text that will be truncated with an ellipsis (…) indicating there is more content.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Excellent across all major browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">text-overflow: "→"</div>
        <div class="demo-text" style="white-space: nowrap; overflow: hidden; text-overflow: '→';">
          This is a very long text that will be truncated with a custom string (in this case an arrow) indicating more content.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Limited, works in Firefox, not in Chrome or Safari</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>clip</td>
        <td>Default. The text is clipped and not accessible</td>
      </tr>
      <tr>
        <td>ellipsis</td>
        <td>Renders an ellipsis ("…") to represent clipped text</td>
      </tr>
      <tr>
        <td>string</td>
        <td>Renders the given string to represent clipped text (limited support)</td>
      </tr>
    </table>

    <div class="note">
      <p><strong>Note:</strong> For <span class="code">text-overflow</span> to have any effect, the element must have <span class="code">overflow</span> set to something other than <span class="code">visible</span>, and the content must be constrained in the inline direction (typically by using <span class="code">white-space: nowrap</span>).</p>
    </div>
  </section>

  <section id="hyphens" class="property-section">
    <h2>Hyphens property</h2>
    
    <p><span class="code">hyphens</span> controls how words break with hyphens when they reach the end of a line.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">hyphens: none</div>
        <div class="demo-text" style="hyphens: none;">
          This demonstration contains some extraordinarily long vocabulary specifically to showcase hyphenation demonstration capabilities of cascading style sheets.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Good in modern browsers, requires prefixes in some</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">hyphens: auto</div>
        <div class="demo-text" style="hyphens: auto;" lang="en">
          This demonstration contains some extraordinarily long vocabulary specifically to showcase hyphenation demonstration capabilities of cascading style sheets.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Varies across browsers, requires lang attribute</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">hyphens: manual</div>
        <div class="demo-text" style="hyphens: manual;">
          This demon&shy;stration contains some extra&shy;ordinarily long voca&shy;bulary speci&shy;fically to show&shy;case hyphen&shy;ation demon&shy;stration capa&shy;bilities.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-good">Good in most modern browsers</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>none</td>
        <td>Words won't break at line ends, even if characters like hyphens suggest breakpoints</td>
      </tr>
      <tr>
        <td>manual</td>
        <td>Words only break at suggested break points (using &amp;shy; or soft hyphens)</td>
      </tr>
      <tr>
        <td>auto</td>
        <td>Browser automatically determines hyphenation points based on language rules</td>
      </tr>
    </table>

    <div class="note">
      <p><strong>Note:</strong> For <span class="code">hyphens: auto</span> to work properly, the content must have a valid <span class="code">lang</span> attribute set (e.g., <span class="code">lang="en"</span>). Browser support and quality of automatic hyphenation varies.</p>
    </div>
  </section>

  <section id="line-break" class="property-section">
    <h2>Line-break property</h2>
    
    <p><span class="code">line-break</span> specifies how to break lines of Chinese, Japanese, or Korean (CJK) text when working with punctuation and symbols.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">line-break: auto (default)</div>
        <div class="demo-text" style="line-break: auto;">
          日本語の例文です。句読点や括弧などの記号も含まれています（例えば、これは括弧内のテキストです）。終わりに句点があります。
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Good in modern browsers, varies in older ones</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">line-break: loose</div>
        <div class="demo-text" style="line-break: loose;">
          日本語の例文です。句読点や括弧などの記号も含まれています（例えば、これは括弧内のテキストです）。終わりに句点があります。
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Varies across browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">line-break: normal</div>
        <div class="demo-text" style="line-break: normal;">
          日本語の例文です。句読点や括弧などの記号も含まれています（例えば、これは括弧内のテキストです）。終わりに句点があります。
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Varies across browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">line-break: strict</div>
        <div class="demo-text" style="line-break: strict;">
          日本語の例文です。句読点や括弧などの記号も含まれています（例えば、これは括弧内のテキストです）。終わりに句点があります。
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Varies across browsers</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">line-break: anywhere</div>
        <div class="demo-text" style="line-break: anywhere;">
          日本語の例文です。句読点や括弧などの記号も含まれています（例えば、これは括弧内のテキストです）。終わりに句点があります。
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Limited, newer property value</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>auto</td>
        <td>Default - uses the default line breaking rules</td>
      </tr>
      <tr>
        <td>loose</td>
        <td>Relaxed line breaking rules, allows more breaks with CJK punctuation</td>
      </tr>
      <tr>
        <td>normal</td>
        <td>Standard line breaking rules</td>
      </tr>
      <tr>
        <td>strict</td>
        <td>Stricter line breaking rules, fewer breaks with CJK punctuation</td>
      </tr>
      <tr>
        <td>anywhere</td>
        <td>Breaks lines at any character</td>
      </tr>
    </table>

    <div class="note">
      <p><strong>Note:</strong> The <span class="code">line-break</span> property is primarily designed for CJK text and may have minimal effect on non-CJK text.</p>
    </div>
  </section>

  <section id="text-wrap" class="property-section">
    <h2>Text-wrap property</h2>
    
    <p><span class="code">text-wrap</span> is a newer CSS property that allows for more control over text wrapping behavior.</p>
    
    <div class="demo-container">
      <div class="demo-box">
        <div class="demo-label">text-wrap: wrap (default)</div>
        <div class="demo-text" style="text-wrap: wrap;">
          This is the default wrapping behavior where text wraps according to the available space in the container.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">New property, limited support</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">text-wrap: nowrap</div>
        <div class="demo-text" style="text-wrap: nowrap;">
          This text will not wrap to the next line, similar to white-space: nowrap but specifically for wrapping behavior.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">New property, limited support</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">text-wrap: balance</div>
        <div class="demo-text" style="text-wrap: balance;">
          This property attempts to balance the amount of text on each line for more visually pleasing line breaks, especially useful for headings.
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Very limited, Chrome and Firefox only</span>
        </div>
      </div>
      
      <div class="demo-box">
        <div class="demo-label">text-wrap: pretty</div>
        <div class="demo-text" style="text-wrap: pretty;">
          Similar to balance, but with less aggressive balancing. Aims to prevent single words on the last line (widows).
        </div>
        <div class="browser-support">
          <strong>Browser support:</strong> <span class="support-partial">Very limited, newest property value</span>
        </div>
      </div>
    </div>

    <table>
      <tr>
        <th>Value</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>wrap</td>
        <td>Default wrapping behavior</td>
      </tr>
      <tr>
        <td>nowrap</td>
        <td>Prevents text from wrapping</td>
      </tr>
      <tr>
        <td>balance</td>
        <td>Attempts to balance the amount of text on each line</td>
      </tr>
      <tr>
        <td>pretty</td>
        <td>Less aggressive than balance, prevents single words on last line</td>
      </tr>
    </table>

    <div class="warning">
      <p><strong>Important:</strong> <span class="code">text-wrap</span> is a newer CSS property with limited browser support. Always use fallbacks when implementing it in production.</p>
    </div>
  </section>

  <!-- Interactive playground section removed as requested -->
